package logic

import (
	"context"
	"regi/models"

	"regi/regirpc/internal/svc"
	"regi/regirpc/regirpc"

	"github.com/zeromicro/go-zero/core/logx"
)

type RegiListLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewRegiListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *RegiListLogic {
	return &RegiListLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

// 列表
func (l *RegiListLogic) RegiList(in *regirpc.RegiListRequest) (*regirpc.RegiListResponse, error) {
	// todo: add your logic here and delete this line

	var regis models.Regi

	list, err := regis.RegisList(models.Regi{}, in)
	if err != nil {
		return nil, err
	}

	return &regirpc.RegiListResponse{
		List: list,
	}, nil
}
